import React from 'react'
import * as RJD from 'react-js-diagrams'
import {ConnectionWidgetFactory } from './nodes/connection/ConnectionWidgetFactory'
import { ConnectionNodeFactory } from './nodes/connection/ConnectionInstanceFactories'
import {DiamondWidgetFactory} from "./nodes/diamond/DiamondWidgetFactory"
import {DiamondNodeFactory} from "./nodes/diamond/DiamondInstanceFactories"
import {DirectedLinkFactory} from "./flow/DirectedLinkFactory"
import {FlowPortInstanceFactory} from "./flow/FlowPortInstanceFactory";
import {FlowDiagramEngine} from "./flow/FlowDiagramEngine"
import {ProcessWidgetFactory} from "./nodes/process/ProcessWidgetFactory"
import {ProcessNodeFactory} from "./nodes/process/ProcessNodeFactory"
import {StartWidgetFactory} from "./nodes/start/StartWidgetFactory"
import {StartNodeFactory} from "./nodes/start/StartNodeFactory"
import {EndWidgetFactory} from "./nodes/end/EndWidgetFactory"
import {EndNodeFactory} from "./nodes/end/EndNodeFactory"

// Setup the diagram engine
export const diagramEngine = new FlowDiagramEngine()
diagramEngine.registerNodeFactory(new RJD.DefaultNodeFactory())
diagramEngine.registerLinkFactory(new DirectedLinkFactory())
diagramEngine.registerNodeFactory(new ConnectionWidgetFactory())
diagramEngine.registerNodeFactory(new DiamondWidgetFactory())
diagramEngine.registerNodeFactory(new ProcessWidgetFactory())
diagramEngine.registerNodeFactory(new StartWidgetFactory())
diagramEngine.registerNodeFactory(new EndWidgetFactory())


// Register instance factories
diagramEngine.registerInstanceFactory(new RJD.DefaultNodeInstanceFactory())
diagramEngine.registerInstanceFactory(new RJD.DefaultPortInstanceFactory())
diagramEngine.registerInstanceFactory(new FlowPortInstanceFactory())
diagramEngine.registerInstanceFactory(new RJD.LinkInstanceFactory())
diagramEngine.registerInstanceFactory(new ConnectionNodeFactory())
diagramEngine.registerInstanceFactory(new DiamondNodeFactory())
diagramEngine.registerInstanceFactory(new ProcessNodeFactory())
diagramEngine.registerInstanceFactory(new StartNodeFactory())
diagramEngine.registerInstanceFactory(new EndNodeFactory())

